home *** CD-ROM | disk | FTP | other *** search
/ Level 2005 Christmas (DVD) / Level_2005-XMAS_134_DVD_Knightshift.iso / Demos / Ski Racing 2006 / setup1.cab / DataCommonShadersDX8Dot3BumpMap.psh < prev    next >
Encoding:
Text File  |  2005-11-03  |  847 b   |  31 lines

  1. ;Light the skin with a directional lights and a bump map.
  2. ;
  3. ;B  = Base map
  4. ;N  = Per pixel normal from normal map
  5. ;D1 = Light 1 Direction in t2
  6. ;C1 = Light 1 Color in c2
  7. ;AL = Ambient lighting in oD0
  8. ;MC = Material color in oD1
  9. ;Oc = Output color
  10. ;Oa = Output alpha
  11. ;
  12. ;Oc = B * ((((N dot D1) * C1) * MC) + AL)
  13. ;Oa = 1
  14.  
  15. ps.1.1
  16.  
  17. def c0, 1.0,0.0,0.0,1.0
  18.  
  19. tex t0                       ; base map
  20. tex t1                       ; normal map
  21. texcoord t2                  ; light vector 1 in tangent space
  22.  
  23. ; N dot L.  Both vectors are biased coming out of the vertex shader.
  24. dp3_sat r1, t1_bx2, t2_bx2   ;N dot L for Light1
  25. mul_sat r1, r1, c2           ;Color for Light2
  26.  
  27. mad_sat r1, r1, v1, v0       ;material diffuse + ambient
  28.  
  29. mul r0.rgb, r1, t0           ;Modulate base map.
  30. +mov r0.a, c0                ;Set alpha to 1.
  31.